import { createStore, applyMiddleware } from 'redux';
import reducer from './reducers';
import reduxLogger from 'redux-logger';
import { thunk } from 'redux-thunk'
import reduxPromise from 'redux-promise';

let middleWare = [reduxPromise, thunk];

// 根据不同环境，使用不同中间件
if (import.meta.env.MODE === 'development') {
    middleWare.push(reduxLogger);
}

const store = createStore(reducer, applyMiddleware(...middleWare));

export default store;